import { useState } from "react";
import { COLORS } from "@/utils/constants";
import { IconColor } from "@/types";
const useSwitch = (initValue = false) => {
  const [open, setOpen] = useState(initValue);
  const toggle = () => {
    setOpen(!open);
  };
  const colorType: IconColor = open ? "primary" : "default";
  const color = COLORS[colorType];
  const textStyle = {
    color: color,
    fontWeight: open ? "bold" : "inherit",
  };
  return { open, toggle, colorType, color, textStyle };
};

export default useSwitch;
